<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:with="title='sys_dict_data'">
<meta charset="utf-8">
<header th:replace="header::header(${title})"></header>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="DictDataForm">
							<div class="form-group">
								<label class="col-sm-3 control-label">字典类型：</label>
								<div class="col-sm-8">
									<input id="dictType" name="dictType" th:value="${dictData.dictType}" readonly="readonly" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">字典编码：</label>
								<div class="col-sm-8">
									<input id="dictNo" name="dictNo" th:value="${dictData.dictNo}" readonly="readonly" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">字典含义：</label>
								<div class="col-sm-8">
									<input id="dictName" name="dictName" th:value="${dictData.dictName}" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">字典描述：</label>
								<div class="col-sm-8">
									<input id="dictDescribe" name="dictDescribe" th:value="${dictData.dictDescribe}" class="form-control" type="text">
									<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 列表回显时显示的样式</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">状态：</label>
								<div class="col-sm-8">
								<label class="radio-inline" th:each="dict:${@dict.getDictDatas('Status')}"> <input th:field="*{dictData.status}" type="radio" th:value="${dict.dictNo}"
										th:text="${dict.dictName}" />
									</label>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">提交</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:replace="footer :: footer"></div>
	<script type="text/javascript">
	var prefix = ctx + "sys/dictData";
	$().ready(function() { 
		validateRule(); 
	}); 
	
	$.validator.setDefaults({ 
		submitHandler : function() { 
			update(); 
		} 
	}); 
	
	function update() {
		YiMo.ajaxPut({ 
			url : prefix + "/update", 
			data : $('#DictDataForm').serialize(), 
			needClose : true, 
			parentRefresh : true, 
		}); 
	} 
	
	function validateRule() { 
		var icon = "<i class='fa fa-times-circle'></i>"; 
		$("#DictDataForm").validate({ 
			rules : { 
				dictNo : { 
					required : true 
				}, 
				dictName : { 
					required : true 
				}, 
				status : { 
					required : true 
				}, 
			},
			messages : { 
				dictNo : { 
					required : icon + "请输入字典编码" 
				}, 
				dictName : { 
					required : icon + "请输入字典含义" 
				}, 
				status : { 
					required : icon + "请输入状态" 
				}, 
			} 
		}) 
	}
	
	</script>
</body>
</html>
